using Microsoft.Build.BuildEngine;
using System.Diagnostics;

/// <summary>
/// This class is a custom MSBuild logger that writes MSBuild messages
/// as trace output. This logger allows the MSBuild output to be seen in
/// a debugger's Output Window.
/// </summary>
public class DebugOutputLogger : ConsoleLogger
{
    public override void Initialize(Microsoft.Build.Framework.IEventSource eventSource)
    {
        this.WriteHandler = new WriteHandler(this.DebugOutputWriteHandler);
        base.Initialize(eventSource);
    }

    private void DebugOutputWriteHandler(string message)
    {
        Trace.Write(message);
    }
}
